package designMode.flyWeight;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by jingqing.zhou on 2015/5/7.
 */
public class FlyWeightFactory {
    private static Map flyweights = new HashMap();
    public FlyWeightFactory(String arg){
        flyweights.put(arg,new FlyWeightImpl());
    }
    public static FlyWeight getFlyweight(String key) {
        if (flyweights.get(key) == null) {
            flyweights.put(key, new FlyWeightImpl());
        }
        return (FlyWeight)flyweights.get(key);
    }

    public static int getSize() {
        return flyweights.size();
    }

}
